/**
 * 
 */
package org.jft.datamodel.config;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author LAP
 *
 */
public class Config {
	private Properties properties;
	
	private Config() {
		properties = new Properties();
	}
	
	private static class ConfigKeeper {
		private static final Config INSTANCE = new Config();
	}
	
	public static Config getInstance() {
		return ConfigKeeper.INSTANCE;
	}
	
	public void setStringProperty(String key, String value) {
		properties.setProperty(key, value);
	}
	
	public void setBooleanProperty(String key, boolean value) {
		properties.setProperty(key, String.valueOf(value));
	}
	
	public boolean getBooleanProperty(String key) {
		return Boolean.getBoolean(properties.getProperty(key));
	}
	
	public String getStringProperty(String key) {
		return properties.getProperty(key);
	}
	
	public void loadConfig(InputStream value) throws IOException {
		properties.clear();
		properties.load(value);
	}
	
}
